<div class="contextual">
<%= link_to_if_authorized l(:button_edit),   {:controller => 'rb_releases', :action => 'edit',    :release_id => @release}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'rb_releases', :action => 'destroy', :release_id => @release}, :confirm => l(:text_are_you_sure), :class => 'icon icon-del' %>
</div>

<h2><%= @release.name %></h2>

<% unless @release.has_burndown? %>
  <p class="nodata">No burndown available</p>
<% else %>
  <div id="release_burndown_<%= @release.id %>" style="margin-left:0px; margin-top:20px; height:500px;"></div>
  <%= render :partial => "rb_release_burndown_charts/burndown", :locals => {:div => 'release_burndown_', :burndown => @release.burndown } %>

  <br />
  <div class="box">
  <% if @release.today %>
    <%= link_to l(:release_update_snapshot_today), {:controller => 'rb_releases', :action => 'snapshot', :release_id => @release}, :class => 'icon icon-save' %>
    (current: <%= @release.today.remaining_story_points %> / new: <b><%= @remaining_story_points  %></b>)
  <% else %>
    <% if Date.today >= @release.release_start_date and Date.today <= @release.release_end_date %>
      <%= link_to l(:release_create_snapshot_today), {:controller => 'rb_releases', :action => 'snapshot', :release_id => @release}, :class => 'icon icon-add' %>
    <% else %>
      <%= link_to l(:release_create_snapshot_today), {:controller => 'rb_releases', :action => 'snapshot', :release_id => @release}, :confirm => l(:today_not_in_release_msg), :class => 'icon icon-add' %>
      <br />
      <b><%= l(:today_not_in_release_warning) %></b>
    <% end %>
  <% end %>
  </div>

  <% other_formats_links do |f| %>
    <%= f.link_to 'CSV', :url => { :release_id => @release } %>
  <% end %>
  <br />

  <fieldset>
      <legend><%= l(:label_chart_options) %></legend>
      <% @release.burndown.series(:all).each do |series| %>
          <input class="series_enabled" type="checkbox" onclick="burndown_configure(this)" id="<%= series.name %>_enabled" name="<%= series.name %>_enabled" value="<%= series.name %>"><%= l(series.name) %><br/>
      <% end %>
  </fieldset>

<% end %>

<% content_for :sidebar do %>
  <h3><%= l(:label_release) %></h3>
  <p><b><%= l(:field_release_start_date) %>:</b>   <%= @release.release_start_date   %></p>
  <p><b><%= l(:field_release_end_date) %>:</b>     <%= @release.release_end_date     %></p>
  <p><b><%= l(:field_initial_story_points) %>:</b> <%= @release.initial_story_points %></p>
  <p><b><%= l(:remaining_story_points) %>:</b>     <%= @remaining_story_points       %></p>
  <p><b><%= l(:field_number_of_snapshots) %>:</b>  <%= @release.burndown_days.size   %></p>
  <% if @release.release_burndown_type > 1 and @release.release_burndown_type < 4 %>
  <h3>Trends</h3>
  <p><b>Daily points burn rate:</b> <%= @release.daily_points_burn_rate %></p>
  <p><b>Daily backlog grow rate:</b> <%= @release.daily_backlog_grow_rate %></p>
  <h3>Estimates</h3>
  <p><b>Computed risk factor:</b> <%= @release.risk_factor %></p>
  <p><b>End date:</b> <%= @release.estimated_end_date %></p>
  <% end %>
  <% if @release.release_burndown_type == 4 %>
  <h3>Trend</h3>
  <p><b>Daily points burn rate:</b> <%= @release.daily_points_burn_rate %></p>
  <h3>Risk Factors</h3>
  <p><b>10% end probability factor:</b> <%= @release.p10_factor %></p>
  <p><b>50% end probability factor:</b> <%= @release.p50_factor %></p>
  <p><b>90% end probability factor:</b> <%= @release.p90_factor %></p>
  <h3>Estimates</h3>
  <p><b>10% end date:</b>   <%= @release.p10_end_date %></p>
  <p><b>50% end date:</b>   <%= @release.p50_end_date %></p>
  <p><b>90% end date:</b>   <%= @release.p90_end_date %></p>
  <% end %>
<% end %>

<% html_title(@release.name) -%>
